package com.liuym.admin.dubbo.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.liuym.admin.repository.model.bo.AdminBO;
import com.liuym.admin.service.AdminService;
import com.liuym.common.dubbo.admin.api.AdminDubboService;
import com.liuym.common.dubbo.admin.dto.AdminDTO;
import com.liuym.common.exception.AdminException;
import com.vip.vjtools.vjkit.mapper.BeanMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author LiuYiMing
 * @date 2018/9/18 11:02
 * @describe：
 */
@Service(version = "${admin.dubbo.version}")
public class AdminDubboServiceImpl implements AdminDubboService {

    @Autowired
    private AdminService adminService;


    @Override
    public AdminDTO getAdminByUserName(String userName) throws AdminException {
        AdminBO adminBO = adminService.getAdminByUserName(userName);
        if (adminBO != null) {
            return BeanMapper.map(adminBO, AdminDTO.class);
        }
        return null;
    }
}
